#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <string.h>

void reverse(char* arr, int start, int end)
{
	while (start < end)
	{
		int tmp = arr[start];
		arr[start] = arr[end];
		arr[end] = tmp;
		start++;
		end--;
	}
}

void main()
{
	char arr[100] = { 0 };
	while (gets(arr))
	{
		int len = strlen(arr);
		int left = 0;
		int right = len - 1;
		reverse(arr, left, right);
		int end = 0;
		char* cur = arr;
		while (1)
		{
			int start = end;
			while (*cur != ' ')
			{
				cur++;
				end++;
				if (*cur == '\0')
				{
					break;
				}
			}
			end = end - 1;
			reverse(arr, start, end);
			if (*cur == '\0')
			{
				break;
			}
			cur++;
			end = end + 2;
		}
		printf("%s\n", arr);
	}

}

